#include <iostream>
#include <vector>
#include "mwerabase.h"
#include "graph.h"
#include "point.h"
#include "link.h"

using namespace std;

int main(){
	MweraBase gr;
	vector<Point*> obstacle[2];
	Point* tmp;
	Point* start;
	Point* goal;	
	
	start = gr.createPoint(0,0);
	goal = gr.createPoint(10,10);
	
	cout << endl << gr << endl;

	tmp = new Point(1,2);
	obstacle[0].push_back(tmp);
	tmp = new Point(1,5);
	obstacle[0].push_back(tmp);
	tmp = new Point(4,5);
	obstacle[0].push_back(tmp);
	tmp = new Point(4,2);
	obstacle[0].push_back(tmp);
	gr.createObstacle(obstacle[0]);
	cout << endl << gr << endl;
	
	tmp = new Point(6,7);
	obstacle[1].push_back(tmp);
	tmp = new Point(6,11);
	obstacle[1].push_back(tmp);
	tmp = new Point(9,11);
	obstacle[1].push_back(tmp);
	tmp = new Point(9,7);
	obstacle[1].push_back(tmp);
	gr.createObstacle(obstacle[1]);
	cout << endl << gr << endl;
	

	Graph* g = gr.getGraph();
	g->astar(start, goal);
			
	/*
	Point* p[10];
	Link* l[22];
	p[0] = gr.createPoint(0,0);
	p[1] = gr.createPoint(1,2);
	p[2] = gr.createPoint(1,5);
	p[3] = gr.createPoint(4,2);
	p[4] = gr.createPoint(4,5);
	p[5] = gr.createPoint(6,6);
	p[6] = gr.createPoint(6,11);
	p[7] = gr.createPoint(9,6);
	p[8] = gr.createPoint(9,11);
	p[9] = gr.createPoint(13,11);

	l[0] = gr.createLink(p[0],p[1]);
	l[1] = gr.createLink(p[0],p[2]);
	l[2] = gr.createLink(p[0],p[3]);

	l[3] = gr.createLink(p[1],p[2]);
	l[4] = gr.createLink(p[1],p[3]);

	l[5] = gr.createLink(p[2],p[4]);
	l[6] = gr.createLink(p[2],p[5]);
	l[7] = gr.createLink(p[2],p[6]);
	l[8] = gr.createLink(p[2],p[7]);

	l[9] = gr.createLink(p[3],p[4]);
	l[10] = gr.createLink(p[3],p[5]);
	l[11] = gr.createLink(p[3],p[6]);
	l[12] = gr.createLink(p[3],p[7]);

	l[13] = gr.createLink(p[4],p[5]);
	l[14] = gr.createLink(p[4],p[6]);
	l[15] = gr.createLink(p[4],p[7]);

	l[16] = gr.createLink(p[5],p[6]);
	l[17] = gr.createLink(p[5],p[7]);

	l[18] = gr.createLink(p[6],p[8]);
	
	l[19] = gr.createLink(p[7],p[8]);
	l[20] = gr.createLink(p[7],p[9]);

	l[21] = gr.createLink(p[8],p[9]);

	cout << gr;
	*/

	return 0;
}
